#pragma once
#include "D3dApp.h"
#include "MouseEvent.h"
#include "KeyBoardEvent.h"

class UIControl
{
protected:
	bool		m_isEnable;
	bool		m_hasFocus;
	bool		m_isDefault;
	bool		m_bMouseOver;
	bool		m_isVisible;
	
	int			m_iWidth;
	int			m_iHeight;
	int			m_iX;
	int			m_iY;
	int			m_iID;
	UINT		m_uIndex;
	UINT		m_uHotKey;

	UIControl*	m_pParent;
	void*		m_pUserData;

public:
					UIControl(UIControl* p_pParent);
	virtual			~UIControl();

	virtual void		onFocus();
	virtual void		onLostFocus();
	virtual void		onMouseUp(MouseEvent* p_event);
	virtual void		onMouseDown(MouseEvent* p_event);
	virtual void		onMouseMove(MouseEvent* p_event);
	virtual void		onMouseEnter(MouseEvent* p_event);
	virtual void		onMouseOut(MouseEvent* p_event);

	virtual void		onKeyUp();
	virtual void		onKeyDown();	
	virtual void		onHotKey();

	virtual	void		onDraw();

	void*				getUserData();
	void				setUserData(void* p_pUserData);
	virtual void		setParent(UIControl* p_pParent);
	virtual UIControl*	getParent();
	UIControl			getElement(UINT p_uIndex);
	bool				isEnable();				
	bool				isVisible();
	bool				isFocus();
	UIControl*			getParent();
	virtual	LPSTR		getType();
};

